﻿using System;
using System.Threading.Tasks;
using System.Web.UI;
using LuceneApiServerLib;
using LuceneNetHelper;
using Newtonsoft.Json;

namespace WebApplication1
{
    public partial class WebForm2 : Page
    {
        protected  void Page_Load(object sender, EventArgs e)
        {

         var m=  vtest().Result;
         Response.Write(JsonConvert.SerializeObject(m));
        }
        public Task<LnPage<Article>> vtest()
        {
            //Random r = new Random(7000);
            //var cl = Request.Form["class"];
            //var l = Class1.Instance.getclient.SearchIndex("")
            //    .MatchField(article => article.Class, true, cl)
            //    .MatchField(article => article.BrandName)
            //    .MatchField(article => article.Property)
            //    .MatchField(article => article.Title)
            //    .MatchField(article => article.Content).Take(50).Skip(1250)
            //    .ToPage();
          
            return Task<LnPage<Article>>.Factory.StartNew(() => (Class1.Instance.getclient.SearchIndex("")
                .MatchField(article => article.Class, true, "")
                .MatchField(article => article.BrandName)
                .MatchField(article => article.Property)
                .MatchField(article => article.Title)
                .MatchField(article => article.KeyWords).Take(50).Skip(0)
                .ToPage()));
        
        }
      
    }
}